home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 386 / insttest / absolute.s next >
Text File  |  1985-11-19  |  3KB  |  111 lines

  1.  ; Program Name: AUT_DATA.S
  2.  ;      Version: 1.001
  3.  
  4.  ; Assembly Instructions:
  5.  
  6.  ;    Assemble in Relocatabe mode and save with a TOS extension.
  7.  
  8.  ; Program Function:
  9.  
  10.  ;    Compares the relative speed and memory requirements of
  11.  
  12.  ;                      lea     label(pc), Am
  13.  ;                      move.l  An, (Am)
  14.  
  15.  ;    and               lea     label, Am
  16.  ;                      move.l  An, (Am)
  17.  
  18.  ;    to                move.l  An, label
  19.  
  20.  ; The execution time reported is for 50,000 executions of each algorithm.
  21.  
  22.  ;    In this program, a data area is declared before the AUT's so that the
  23.  ; first AUT can't disrupt the adaptive algorithm.  The address of the data
  24.  ; area is passed to the adaptive algorithm in register A2.
  25.  
  26.  ;    A branch statement is included in each AUT so that the adaptive algorithm
  27.  ; will jump over the data area.
  28.   
  29.  ;    Of course, this calls for a redesign of the adaptive algorithm.
  30.  
  31. calculate_program_size:
  32.  lea        -$102(pc), a1       ; Fetch basepage start address.
  33.  lea        program_end(pc), a0     ; Fetch program end = array address.
  34.  trap       #6                  ; Return unused memory to op system.
  35.  lea        stack(pc), a7
  36.  
  37. initialize_registers_1:
  38.  lea        header_1(pc), a0
  39.  lea        header_2(pc), a1
  40.  lea        lea_data_area(pc), a2
  41.  lea        lea_move_start(pc), a3
  42.  lea        lea_move_end(pc), a4
  43.  lea        heading(pc), a5
  44.  move.w     #50000, d7
  45.  trap       #9
  46.  
  47. initialize_registers_2:
  48.  lea        header_3(pc), a0
  49.  lea        header_4(pc), a1
  50.  lea        long_data_area(pc), a2
  51.  lea        long_lea_start(pc), a3
  52.  lea        long_lea_end(pc), a4
  53.  lea        heading(pc), a5
  54.  move.b     #0, (a5)            ; Store a NULL in first byte to create a
  55.  move.w     #50000, d7          ; null string so that heading gets printed
  56.  trap       #9                  ; only once.
  57.  
  58. initialize_registers_3:
  59.  lea        header_5(pc), a0
  60.  lea        header_6(pc), a1
  61.  lea        move_data_area(pc), a2
  62.  lea        move_start(pc), a3
  63.  lea        move_end(pc), a4
  64.  lea        heading(pc), a5
  65.  move.w     #50000, d7     
  66.  trap       #9             
  67.  
  68. terminate:
  69.  trap       #8
  70.  
  71. lea_data_area:
  72.  bra.s      lea_move_start
  73. label_1:    ds.l 1
  74. lea_move_start:                
  75.  lea        label_1(pc), a2
  76.  move.l     a0, (a2)           
  77. lea_move_end:
  78.  
  79. long_data_area:
  80.  bra.s      long_lea_start
  81. label_2:    ds.l 1
  82. long_lea_start:              
  83.  lea        label_2(pc), a2
  84.  move.l     a0, (a2)         
  85. long_lea_end:
  86.  
  87. move_data_area:
  88.  bra.s      move_start
  89. label_3:    ds.l 1
  90. move_start:
  91.  lea        label_3(pc), a2
  92.  move.l     a0, (a2)
  93. move_end:                    
  94.          
  95.  data
  96. heading:      dc.b       "AUT_DATA Program Results",$D,$A,$D,$A,0
  97. header_1:     dc.b       "  Elapsed time for lea    label(pc), Am ",$D,$A
  98.               dc.b       "                   move.l An, (Am):      ",0
  99. header_2:     dc.b       "  Memory required for first algorithm:      ",0
  100. header_3:     dc.b $D,$A,"  Elapsed time for lea    label, Am ",$D,$A
  101.               dc.b       "                   move.l An, (Am):      ",0
  102. header_4:     dc.b       "  Memory required for second algorithm:     ",0
  103. header_5:     dc.b $D,$A,"  Elapsed time for move.l An, label:     ",0
  104. header_6:     dc.b       "  Memory required for third algorithm:      ",0
  105.  bss
  106.  align
  107.               ds.l 96
  108. stack:        ds.l  0
  109. program_end:  ds.l  0 
  110.  end